www.gusucode.com > 基于Matlab的MIMO通信系统仿真 含报告;司中威;了解移动通信 > 基于Matlab的MIMO通信系统仿真 含报告;司中威;了解移动通信关键技术,了解数字通信系统仿真流程,实现基本的信道编译码、调制解调等通信模块。(好评如潮,课设拿满) 学习并实现MIMO空时处理技术 学习性能分析的思路和方法/mimo/matlab for mimo 2x2/MLDetector.m

    function [r1_data_I, r1_data_Q, r2_data_I, r2_data_Q] = MLDetector(H, rA_data_I, rA_data_Q, rB_data_I, rB_data_Q)
% Function MLDetector
% By Maxime Maury
% 05-04-21
% Inputs:
%   rA_data:    received symbols on antenna A
%   rA_data:    received symbols on antenna B
%   H:          Estimated channel matrix for the data
% Outputs:
%   r1_data:    Estimated symbol sent on antenna 1
%   r2_data:    Estimated symbol sent on antenna 2

const = [-3 -1 1 3];

% Received vector
Y_r = [ rA_data_I + sqrt(-1)* rA_data_Q; rB_data_I + sqrt(-1)* rB_data_Q ];

data_len = size(Y_r,2);
S_out = zeros(2,data_len);

for p=1:data_len     
        
    Y = Y_r(:,p);
    
	% Start with one S
	S = [ -3 + sqrt(-1)*(-3) ; -3 + sqrt(-1)*(-3) ];

    Z = Y - H*S;
    normmin = norm_ML(Z);
	S_out(:,p) = S;
	
	for s1_I = const
        for s1_Q = const
            for s2_I = const
                for s2_Q = const      
                    
                    
                       S = [ s1_I + sqrt(-1)*s1_Q ; s2_I + sqrt(-1)*s2_Q ];
                    
                       Z = Y - H*S;
                       newnorm = norm_ML(Z);
                       
                       if (newnorm<normmin)
                       
                       normmin = newnorm;
                           S_out(:,p) = S;
                       end
                end
            end
        end    
	end
    
end

r1_data_I = real(S_out(1,:));
r1_data_Q = imag(S_out(1,:));
r2_data_I = real(S_out(2,:));
r2_data_Q = imag(S_out(2,:));